﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace GameObjectsAndEquipment.Weapons
{
    public class MachineGun : Weapon
    {
        public MachineGun(Vector2 position, Texture2D texture, Texture2D bulletTexture, GameObject go, List<Bullet> bulletsOnStage)
            : base(position, texture, bulletTexture, go,bulletsOnStage,1.5f, 250, 400,10,"MachineGun")
        {

        }

        public override void Update(GameTime gametime)
        {
            base.Update(gametime);
        }

        public override void Shoot(Vector2 destinationPoint, bool isPlayers)
        {
            base.Shoot(destinationPoint, isPlayers);

            if (isShootable)
            {
                Vector2 bulletVelocity = destinationPoint - go.Position;
                bulletVelocity.Normalize();
                Vector2 normalized = bulletVelocity;
                bulletVelocity *= speed;

                bulletsOnStage.Add(new Bullet(go.Position, bulletVelocity, bulletTexture, isPlayers));

                bullets--;
                lastShotTime = 0;
                isShootable = false;
                
            }


        }
    }
}
